/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.view;

import com.model.Paket;
import com.rekap.*;
import java.sql.SQLException;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author User
 */
public class view_menu extends javax.swing.JFrame {

    /**
     * Creates new form view_menu
     */
    public view_menu() {
        initComponents();
        appear();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jMenuBar1 = new javax.swing.JMenuBar();
        file = new javax.swing.JMenu();
        home = new javax.swing.JMenuItem();
        exit = new javax.swing.JMenu();
        menuEdit = new javax.swing.JMenu();
        order = new javax.swing.JMenuItem();
        lihatPesanan = new javax.swing.JMenuItem();
        paket = new javax.swing.JMenu();
        lihatDaftarPaket = new javax.swing.JMenuItem();
        tambahPaket = new javax.swing.JMenuItem();
        member = new javax.swing.JMenu();
        lihatMember = new javax.swing.JMenuItem();
        tambahMember = new javax.swing.JMenuItem();

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/images/background.jpg"))); // NOI18N

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jButton1.setText("Kembali");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(350, 300, -1, -1));

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null},
                {null, null, null, null, null, null, null}
            },
            new String [] {
                "Title 1", "Title 2", "Title 3", "Title 4", "Title 5", "Title 6", "Title 7"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 140, 490, 120));

        jLabel3.setFont(new java.awt.Font("Papyrus", 1, 24)); // NOI18N
        jLabel3.setText("PAKET");
        getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(200, 80, -1, -1));

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/images/background.jpg"))); // NOI18N
        getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, -1, 380));

        file.setText("File");

        home.setText("Home");
        home.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                homeActionPerformed(evt);
            }
        });
        file.add(home);

        exit.setText("Exit");
        exit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitActionPerformed(evt);
            }
        });
        file.add(exit);

        jMenuBar1.add(file);

        menuEdit.setText("Pesanan");
        menuEdit.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuEditActionPerformed(evt);
            }
        });

        order.setText("order");
        order.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                orderActionPerformed(evt);
            }
        });
        menuEdit.add(order);

        lihatPesanan.setText("lihat pesanan");
        lihatPesanan.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lihatPesananActionPerformed(evt);
            }
        });
        menuEdit.add(lihatPesanan);

        jMenuBar1.add(menuEdit);

        paket.setText("Paket");

        lihatDaftarPaket.setText("lihat daftar Paket");
        lihatDaftarPaket.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lihatDaftarPaketActionPerformed(evt);
            }
        });
        paket.add(lihatDaftarPaket);

        tambahPaket.setText("tambah Paket");
        tambahPaket.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                tambahPaketActionPerformed(evt);
            }
        });
        paket.add(tambahPaket);

        jMenuBar1.add(paket);

        member.setText("Member");

        lihatMember.setText("lihat Member");
        lihatMember.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                lihatMemberActionPerformed(evt);
            }
        });
        member.add(lihatMember);

        tambahMember.setText("tambah Member");
        member.add(tambahMember);

        jMenuBar1.add(member);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
FormMenuTambah tambah = new FormMenuTambah();
tambah.setVisible(true);
this.dispose();// TODO add your handling code here:
    }//GEN-LAST:event_jButton1ActionPerformed

    private void homeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_homeActionPerformed
        FromMenuOperator home = new FromMenuOperator();
        home.setVisible(true);
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_homeActionPerformed

    private void exitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_exitActionPerformed
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_exitActionPerformed

    private void orderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orderActionPerformed
        FormPesanan pesan = new FormPesanan();
        pesan.setVisible(true);
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_orderActionPerformed

    private void lihatPesananActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lihatPesananActionPerformed
        view_pesanan viewp = new view_pesanan();
        viewp.setVisible(true);
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_lihatPesananActionPerformed

    private void menuEditActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuEditActionPerformed
        FormPesanan edit = new FormPesanan();
        edit.setVisible(true);
        this.dispose();// TODO add your handling code here:
    }//GEN-LAST:event_menuEditActionPerformed

    private void lihatDaftarPaketActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lihatDaftarPaketActionPerformed
        view_menu viewm = new view_menu();
        viewm.setVisible(true);
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_lihatDaftarPaketActionPerformed

    private void tambahPaketActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_tambahPaketActionPerformed
        FormMenuTambah addMenu = new FormMenuTambah();
        addMenu.setVisible(true);
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_tambahPaketActionPerformed

    private void lihatMemberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_lihatMemberActionPerformed
        view_member viewber = new view_member();
        viewber.setVisible(true);
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_lihatMemberActionPerformed
    private void appear (){
        try{
            List <Paket> kategoris =
            TableKontrol.getKoneksiKategori().menu();
            model_menu model = new model_menu(kategoris);
            jTable1.setModel(model);
           } catch (SQLException ex){
                   Logger.getLogger(view_member.class.getName()).log(Level.SEVERE,null,ex);
    }
    }
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(view_menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(view_menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(view_menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(view_menu.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new view_menu().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JMenu exit;
    private javax.swing.JMenu file;
    private javax.swing.JMenuItem home;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable jTable1;
    private javax.swing.JMenuItem lihatDaftarPaket;
    private javax.swing.JMenuItem lihatMember;
    private javax.swing.JMenuItem lihatPesanan;
    private javax.swing.JMenu member;
    private javax.swing.JMenu menuEdit;
    private javax.swing.JMenuItem order;
    private javax.swing.JMenu paket;
    private javax.swing.JMenuItem tambahMember;
    private javax.swing.JMenuItem tambahPaket;
    // End of variables declaration//GEN-END:variables
}
